#ifndef __COMMON_H__
#define __COMMON_H__

/**
*@file       common.h
*@brief      common definition of net libray
*
*@author     graywind
*@version    1.0.0.0
*@data       2011/11/15
*/

///@brief    operate types
enum  eOperateType
{
	Listen     = 0, //accept a new session
	Connect    = 1, //connect to a server
	Kick       = 2, //kick the client
	Disconnect = 3, //disconnect from the server
	Send       = 4, //send message
	Read       = 5  //recv message
};

///@brief    types of session usage
enum eUsageType
{
    Usage_Invalid = 0, //invalid, means not used
    Usage_Connect = 1, //this session connected with server
    Usage_Listen  = 2,  //this session connected with client
};

#ifndef WIN32
#define __stdcall
#endif

///@brief    ptr type of callback function
typedef void(__stdcall *MsgProc)(int session_id, void* pMsgBuffer, unsigned long msgID, unsigned long msg_bytes, eOperateType type, int error_code);


#ifdef WIN32

     #ifdef __EXPORT_LIB__
        #define _NET_LIB "C" __declspec (dllexport)
     #else
        #define _NET_LIB "C" __declspec (dllimport)
     #endif
#else
     #ifdef __EXPORT_LIB__
        #define _NET_LIB "C"
     #else
        #define _NET_LIB "C"
     #endif

#endif

#endif
